package com.tenglong.teacher.ui.adapter;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.tenglong.teacher.R;
import com.tenglong.teacher.data.resultInfo.HomeDetailInfo;
import com.tenglong.teacher.ui.adapter.viewholder.HomeWorkDetailListViewHolder;
import com.tenglong.teacher.ui.adapter.viewholder.base.BaseViewHolder;

import java.util.List;

/**
 * @author hdx on 2019/5/13.
 */
public class HomeWorkDetailListAdapter extends RecyclerView.Adapter<BaseViewHolder<HomeDetailInfo>> {
    private List<HomeDetailInfo> infos;
    public HomeWorkDetailListAdapter(List<HomeDetailInfo> infos){
        this.infos = infos;
    }

    @NonNull
    @Override
    public BaseViewHolder<HomeDetailInfo> onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        return new HomeWorkDetailListViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.homework_detail_item_layout,viewGroup,false));
    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder<HomeDetailInfo> homeDetailInfoBaseViewHolder, int i) {
        homeDetailInfoBaseViewHolder.setLayoutInfo(infos.get(i));
    }

    @Override
    public int getItemCount() {
        return infos.size();
    }
}
